Contents | Index | < Browse | Browse >
LETTERexpULETTER
Exponential function.
Overview
#include <math.h>
r = exp(x);
double r; // e to the power of x
double x; // power
Portability
ANSI
Description
The "exp" function raises the natural logarithm base e to the x power.
x does not necessarily need to be a whole number.
Returns
"exp" returns a double-precision floating-point number containing the
calculated exponential.
See also
log
Example
#include <stdio.h>
#include <math.h>
void main(void)
{
double result, x = 4.0;
result = exp(x);
printf("`e' raised to the power of %lf (e ^ %lf) = %lf\n,
x, x, result);
}